feat+fix(image): 修复图片统计与预览链路,补齐筛选、缩略图、下载与图生图示例#14
Open
Laurel-rao wants to merge 3 commits into432539:mainfrom
Open
feat+fix(image): 修复图片统计与预览链路,补齐筛选、缩略图、下载与图生图示例#14Laurel-rao wants to merge 3 commits into432539:mainfrom
Laurel-rao wants to merge 3 commits into432539:mainfrom
Conversation
修复图片任务历史页面图片无法显示的问题。上游 chatgpt.com 的图片 URL 需要 Authorization header,浏览器直接访问会 403。 Changes: - 新增 internal/image/proxy_url.go 提供共享的签名逻辑 - me_handler.go 和 admin_handler.go 改为返回 /p/img/... 代理 URL - 重构 images_proxy.go 使用共享签名函数,消除代码重复 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
本 PR 主要完善图片任务链路,修复图片数量统计不准确和历史图片预览 403 问题,同时补齐缩略图预览、放大与下载能力,并补充图生图接口示例,覆盖后端统计、图片代理、个人中心、管理端和 API 文档页。
修改项:
修复图片生成数量统计错误
image_count回写type='image'、status='success'但image_count=0的记录按 1 张兜底统计,避免总量偏小修复历史图片预览 403
新增图片缩略图链路
thumb_kb参数,范围0-64thumb_kb>0时服务端将原图压缩为 JPEG 缩略图返回/Users/raojiajun/mypro/backend/gpt2api/internal/image/thumb.go,按宽度和质量多档降级,尽量控制输出体积upscale,避免先放大再压缩带来的额外 CPU 开销X-Thumb-KB头,便于确认缩略图命中新增个人图片任务筛选能力
/api/me/images/tasks新增查询参数status、keyword、start_at、end_at2006-01-02 15:04:05、RFC3339、2006-01-02优化管理端图片任务页
优化个人中心图片历史页
thumb_kb=10的压缩预览,降低加载体积补充图生图调用示例
reference_images的 curl 示例requests版图片生成示例requests版图生图示例reference_images支持 URL、data URL、纯 base64,以及最多 4 张、单张最大 20 MB 的说明其他同步变更
web/package-lock.json同步了license元数据字段,无业务行为变化验证:
go vet ./...go test ./...cd web && npm run build说明: